// eslint-disable-next-line
import { UserLayout, BasicLayout, RouteView, PageView } from '@/layouts'
import {rewardHbApplyList} from "@/api/short";

export const asyncRouterMap = [
  {
    path: '/',
    name: 'index',
    component: BasicLayout,
    meta: { title: '首页',  roles: ['admin','agent','commissioner','salesman'] },
    redirect: '/index/index', //'/invest/finance',
    children: [
      {
        path: '/dashboard',
        name: 'dashboard',
        component: RouteView,
        redirect: '/index/index',
        meta: {
          title: '概况',
          keepAlive: true,
          icon: 'https://91xft-static.oss-cn-hangzhou.aliyuncs.com/xft-cli/pp/pp-gaikuang-0417.png',
          activeIcon:
            'https://91xft-static.oss-cn-hangzhou.aliyuncs.com/xft-cli/pp/pp-gaikuang-active-0417.png',
          roles: ['admin','agent','commissioner','salesman']
        },
        children: [
          {
            path: '/dashboard/analysis',
            name: 'dashboardAnalysis',
            component: PageView,
            hideChildrenInMenu: true,
            meta: { title: '数据分析', keepAlive: true },
            children: [
              {
                path: '/index/index',
                name: 'indexIndex',
                hideChildrenInMenu: true,
                component: () => import('@/views/index/index'),
                meta: { title: '首页', keepAlive: true }
              }
              // {
              //   path: '/dashboard/analysis/index',
              //   name: 'Analysis',
              //   hideChildrenInMenu: true,
              //   component: () => import('@/views/dashboard/analysis/index'),
              //   meta: { title: '首页', keepAlive: true }
              // },
              // {
              //   path: '/dashboard/manage/log',
              //   name: 'dashboardManageLog',
              //   hidden: true,
              //   component: () => import('@/views/dashboard/manage/log'),
              //   meta: { title: '操作日志', keepAlive: true }
              // },
            ]
          }
        ]
      },
        {
          path: '/dashboard/track',
          name: 'dashboardTracks',
          component: RouteView,
          redirect: '/dashboard/track',
          meta: {
            title: '流量',
            keepAlive: true,
            icon: 'https://91xft-static.oss-cn-hangzhou.aliyuncs.com/xft-cli/pp/pp-gaikuang-0417.png',
            activeIcon:
              'https://91xft-static.oss-cn-hangzhou.aliyuncs.com/xft-cli/pp/pp-gaikuang-active-0417.png',
            roles:['admin','track']
          },
          children: [
            {
              path: '/dashboard/track',
              name: 'dashboard_track',
              component: PageView,
              hideChildrenInMenu: true,
              meta: { title: '流量分析', keepAlive: true },
              children: [
                
                {
                  path: '/dashboard/track/activite',
                  name: 'activite',
                  hideChildrenInMenu: true,
                  component: () => import('@/views/dashboard/track/activite'),
                  meta: { title: '流量分析', keepAlive: true }
                }
              ]
            }
          ]
    },
      {
        path: '/market',
        name: 'market',
        component: RouteView,
        redirect: '/market/video',
        meta: {
          title: '营销',
          keepAlive: true,
          icon: 'https://91xft-static.oss-cn-hangzhou.aliyuncs.com/xft-cli/pp/pp-gaikuang-0417.png',
          activeIcon:
            'https://91xft-static.oss-cn-hangzhou.aliyuncs.com/xft-cli/pp/pp-gaikuang-active-0417.png',
          roles: ['admin','agent','commissioner','salesman']
        },
        children: [
          {
            path: '/market/manage',
            name: 'marketManage',
            component: PageView,
            hideChildrenInMenu: true,
            meta: { title: '营销管理', keepAlive: true },
            children: [
              // {
              //   path: '/system/menu',
              //   name: 'systemMenu',
              //   hideChildrenInMenu: true,
              //   component: () => import('@/views/system/menu'),
              //   meta: { title: '菜单管理', keepAlive: true }
              // },
              {
                path: '/market/video',
                name: 'MarketVideoList',
                hideChildrenInMenu: true,
                component: () => import('@/views/market/video'),
                meta: { title: '短剧管理', keepAlive: true,roles: ['admin'] }
              },
              {
                path: '/market/member',
                name: 'marketMemberList',
                hideChildrenInMenu: true,
                component: () => import('@/views/market/member'),
                meta: { title: '会员管理', keepAlive: true  }
              },
              {
                path: '/market/hbList',
                name: 'hbList',
                hideChildrenInMenu: true,
                component: () => import('@/views/market/hbList'),
                meta: { title: '红包管理', keepAlive: true }
              },
              {
                path: '/market/hbAppleList',
                name: 'hbAppleList',
                hideChildrenInMenu: true,
                component: () => import('@/views/market/hbAppleList'),
                meta: { title: '红包额度管理', keepAlive: true }
              },
              {
                path: '/market/product',
                name: 'marketProduct',
                hideChildrenInMenu: true,
                component: () => import('@/views/market/product'),
                meta: { title: 'H5产品', keepAlive: true, roles: ['admin'] }
              },
              {
                path: '/market/reward',
                name: 'marketReward',
                hideChildrenInMenu: true,
                component: () => import('@/views/market/reward'),
                meta: { title: '分红管理', keepAlive: true }
              },
              {
                path: '/market/activtie',
                name: 'marketActivtie',
                hideChildrenInMenu: true,
                component: () => import('@/views/market/activtie'),
                meta: { title: '活动管理', keepAlive: true }
              },
              {
                path: '/market/activtieDetail',
                name: 'marketActivtieDetail',
                hideChildrenInMenu: true,
                component: () => import('@/views/market/activtieDetail'),
                meta: { title: '活动记录', keepAlive: true }
              }
            ]
          }
        ]
      },
      {
        path: '/order',
        name: 'order',
        component: RouteView,
        redirect: '/order/list',
        meta: {
          title: '订单',
          keepAlive: true,
          icon: 'https://91xft-static.oss-cn-hangzhou.aliyuncs.com/xft-cli/pp/pp-gaikuang-0417.png',
          activeIcon:
            'https://91xft-static.oss-cn-hangzhou.aliyuncs.com/xft-cli/pp/pp-gaikuang-active-0417.png',
          roles: ['admin','agent','commissioner','salesman']
        },
        children: [
          {
            path: '/order/manage',
            name: 'orderManage',
            component: PageView,
            hideChildrenInMenu: true,
            meta: { title: '系统管理', keepAlive: true },
            children: [
              // {
              //   path: '/system/menu',
              //   name: 'systemMenu',
              //   hideChildrenInMenu: true,
              //   component: () => import('@/views/system/menu'),
              //   meta: { title: '统计', keepAlive: true }
              // },
              {
                path: '/order/list',
                name: 'orderList',
                hideChildrenInMenu: true,
                component: () => import('@/views/order/list'),
                meta: { title: '订单管理', keepAlive: true }
              },
              {
                path: '/order/tx',
                name: 'orderTx',
                hideChildrenInMenu: true,
                component: () => import('@/views/order/tx'),
                meta: { title: '提现管理', keepAlive: true }
              },
              // {
              //   path: '/order/redPacket',
              //   name: 'redPacket',
              //   hideChildrenInMenu: true,
              //   component: () => import('@/views/order/redPacket'),
              //   meta: { title: '红包管理', keepAlive: true }
              // }
            ]
          }
        ]
      },
      {
        path: '/system',
        name: 'system',
        component: RouteView,
        redirect: '/system/menu',
        meta: {
          title: '权限',
          keepAlive: true,
          icon: 'https://91xft-static.oss-cn-hangzhou.aliyuncs.com/xft-cli/pp/pp-gaikuang-0417.png',
          activeIcon:
            'https://91xft-static.oss-cn-hangzhou.aliyuncs.com/xft-cli/pp/pp-gaikuang-active-0417.png',
          roles: ['admin', 'agent', 'commissioner']
        },
        children: [
          {
            path: '/payConfig',
            name: 'payConfig',
            hideChildrenInMenu: true,
            component: PageView,
            roles: ['admin'],
            meta: { title: '支付管理', keepAlive: true },
            children: [
              {
                path: '/payConfig',
                name: 'payConfigList',
                meta: { title: '支付管理', keepAlive: true },
                component: () => import('@/views/system/payConfig'),
              }
            ]
          },
          {
            path: '/system/manage',
            name: 'systemManage',
            component: PageView,
            hideChildrenInMenu: true,
            meta: { title: '系统管理', keepAlive: true },
            children: [
              {
                path: '/system/version',
                name: 'AppVersion',
                hideChildrenInMenu: true,
                component: () => import('@/views/system/appVersion'),
                meta: { title: 'App版本管理', keepAlive: true }
              },
              {
                path: '/customer',
                name: 'customerServiceList',
                hideChildrenInMenu: true,
                roles: ['admin'],
                meta: { title: '客服管理', keepAlive: true },
                component: () => import('@/views/system/customer.vue'),
              },
              // {
              //   path: '/system/role',
              //   name: 'systemRole',
              //   hideChildrenInMenu: true,
              //   component: () => import('@/views/system/role'),
              //   meta: { title: '角色管理', keepAlive: true }
              // },
              {
                path: '/system/account',
                name: 'systemAccount',
                hideChildrenInMenu: true,
                component: () => import('@/views/system/account'),
                meta: { title: '账号管理', keepAlive: true }
              }
            ]
          }
        ]
      }
    ]
  },
  {
    path: '*',
    redirect: '/404',
    hidden: true
  }
]

/**
 * 基础路由
 * @type { *[] }
 */
export const constantRouterMap = [
  {
    path: '/user',
    component: UserLayout,
    redirect: '/user/login',
    hidden: true,
    children: [
      {
        path: 'login',
        name: 'login',
        component: () => import(/* webpackChunkName: "user" */ '@/views/user/Login')
      },
      {
        path: 'register',
        name: 'register',
        component: () => import(/* webpackChunkName: "user" */ '@/views/user/Register')
      },
      {
        path: 'register-result',
        name: 'registerResult',
        component: () => import(/* webpackChunkName: "user" */ '@/views/user/RegisterResult')
      },
      {
        path: 'recover',
        name: 'recover',
        component: undefined
      }
    ]
  },

  {
    path: '/404',
    component: () => import(/* webpackChunkName: "fail" */ '@/views/exception/404')
  },
  {
    path: '/platformJump',
    name: 'platformJump',
    component: () => import(/* webpackChunkName: "user" */ '@/views/user/platformJump')
  }
]
